#!/usr/bin/perl

use strict;
use warnings;

my $inname = shift @ARGV;
my $infile;

if (defined $inname) {
	open $infile, "<", $inname or die "Couldn't read $inname: $!";
} else {
	$infile = *STDIN;
}

binmode $infile;

my $byte;
my $filesum = 0;

while (read ($infile, $byte, 1)) {
	$filesum += ord $byte;
}

close $infile;

print STDOUT "$filesum\n";

exit 0;
